![]() |
PATH![]() |
![]() ![]() |
Exists is an application command that determines whether the object specified by a reference exists.
The result is true if all of the objects referred to by referenceToObject exist, false if one or more of the objects referred to by referenceToObject do not exist. Class: Boolean
The following example checks whether a folder exists before attempting to count the files in the folder.
tell application "Finder"
if folder "Apple Extras" of startup disk exists then
count files in folder "Apple Extras" of startup disk
end if
end tell
The next example deletes the first paragraph from a report document, if the paragraph exists.
tell document "My Report" of application "AppleWorks"
if paragraph 1 of text body exists then
delete paragraph 1 of text body
end if
end tell